package com.shrct.businessprocess.purchase.impl;

import com.shrct.businessprocess.purchase.RCBudgetContractProductItem;
import com.shrct.businessprocess.purchase.RCIdentifiablePhysicalProductInStockEvent;
import com.shrct.businessprocess.purchase.impl.RCBudgetContractProductItemImpl;
import com.shrct.businessprocess.purchase.impl.RCIdentifiableProductInStockEventImpl;
import com.shrct.businessprocess.purchase.proxy.RCIdentifiablePhysicalProductInStockEventProxy;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@Entity
@DiscriminatorValue("RCIDENTIFIABLEPHYSICALPRODUCTINSTOCKEVENT_TYPE")
public class RCIdentifiablePhysicalProductInStockEventImpl extends RCIdentifiableProductInStockEventImpl implements RCIdentifiablePhysicalProductInStockEvent {
  public RCIdentifiablePhysicalProductInStockEventImpl() {
    super();
  }
  
  @JoinColumn(name = "contractItem_id")
  @ManyToOne(targetEntity = RCBudgetContractProductItemImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCBudgetContractProductItem contractItem;
  
  public RCBudgetContractProductItem getContractItem() {
    return this.contractItem;
  }
  
  public RCIdentifiablePhysicalProductInStockEvent setContractItem(final RCBudgetContractProductItem contractItem) {
    this.contractItem = contractItem;
    return this;			
    
  }
  
  public static RCIdentifiablePhysicalProductInStockEvent create(final IObjectFactory objectFactory) {
    com.shrct.businessprocess.purchase.RCIdentifiablePhysicalProductInStockEvent rCIdentifiablePhysicalProductInStockEvent = new com.shrct.businessprocess.purchase.impl.RCIdentifiablePhysicalProductInStockEventImpl(
    );
    objectFactory.create(rCIdentifiablePhysicalProductInStockEvent);
    return rCIdentifiablePhysicalProductInStockEvent;			
    
  }
  
  public static RCIdentifiablePhysicalProductInStockEvent createRCIdentifiablePhysicalProductInStockEventImpl(final IObjectFactory objectFactory, final Procedure1<RCIdentifiablePhysicalProductInStockEvent> init) {
    com.shrct.businessprocess.purchase.RCIdentifiablePhysicalProductInStockEvent rCIdentifiablePhysicalProductInStockEvent = new com.shrct.businessprocess.purchase.impl.RCIdentifiablePhysicalProductInStockEventImpl(
    );
    objectFactory.create(rCIdentifiablePhysicalProductInStockEvent);
    init.apply(rCIdentifiablePhysicalProductInStockEvent);
    
    return rCIdentifiablePhysicalProductInStockEvent;			
    
  }
  
  public RCIdentifiablePhysicalProductInStockEventProxy toProxy() {
    com.shrct.businessprocess.purchase.proxy.RCIdentifiablePhysicalProductInStockEventProxy proxy = new com.shrct.businessprocess.purchase.proxy.RCIdentifiablePhysicalProductInStockEventProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
